<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>exd_output (FprExdCmd)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/fpr_exd.rb, line 158</span>
        <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exd_output</span>
                <span class="ruby-identifier">host</span> =<span class="ruby-identifier">ask</span>(<span class="ruby-value str">'server hostname/ip?'</span>)
                <span class="ruby-identifier">port</span> =<span class="ruby-identifier">ask</span>(<span class="ruby-value str">'port?'</span>,<span class="ruby-constant">Integer</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">q</span><span class="ruby-operator">|</span> 
                        <span class="ruby-identifier">q</span>.<span class="ruby-identifier">default</span>=<span class="ruby-value str">&quot;80&quot;</span>
                        <span class="ruby-identifier">q</span>.<span class="ruby-identifier">in</span> =<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">65535</span>
                <span class="ruby-keyword kw">end</span>

                <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>
                <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-value str">'requests'</span>)
                <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
                <span class="ruby-identifier">entry</span> = <span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'request'</span>)
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;method&quot;</span>] = <span class="ruby-value str">&quot;GET&quot;</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;scheme&quot;</span>] = <span class="ruby-value str">&quot;http&quot;</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;httpVersion&quot;</span>] = <span class="ruby-value str">'HTTP/1.1'</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;host&quot;</span>] = <span class="ruby-identifier">host</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;port&quot;</span>] = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;path&quot;</span>] = <span class="ruby-identifier">path</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;boundary&quot;</span>] = <span class="ruby-value str">&quot;&quot;</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;pathQuerySeparator&quot;</span>] = <span class="ruby-value str">&quot;?&quot;</span>
                <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;japEncoding&quot;</span>] = <span class="ruby-value str">&quot;0&quot;</span>

                <span class="ruby-identifier">headers</span> =[
                        {<span class="ruby-value str">'Accept'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'</span>},
                        {<span class="ruby-value str">'Referer'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-node">&quot;http://#{host}:#{port}/&quot;</span>},
                        {<span class="ruby-value str">'Accept-Language'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'en'</span>},
                        {<span class="ruby-value str">'UA-CPU'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'x86'</span>},
                        {<span class="ruby-value str">'User-Agent'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'</span>},
                        {<span class="ruby-value str">'Host'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-identifier">host</span>},
                        {<span class="ruby-value str">'Connection'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'Keep-Alive'</span>}
                ]

                <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
                        <span class="ruby-identifier">header_entry</span> = <span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'header'</span>)
                        <span class="ruby-identifier">header_entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;name&quot;</span>]= <span class="ruby-identifier">x</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]
                        <span class="ruby-identifier">header_entry</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;value&quot;</span>]=<span class="ruby-identifier">x</span>.<span class="ruby-identifier">values</span>[<span class="ruby-value">0</span>]
                        <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">add_element</span> <span class="ruby-identifier">header_entry</span>
                <span class="ruby-keyword kw">end</span>

                <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">add_element</span> <span class="ruby-identifier">entry</span>
                <span class="ruby-keyword kw">end</span>
                <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-value str">&quot;file_listing.exd&quot;</span>,<span class="ruby-value str">&quot;w&quot;</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span><span class="ruby-identifier">doc</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">f</span>,<span class="ruby-value">2</span>)}
        <span class="ruby-keyword kw">end</span></pre>
</body>
</html>